package com.wing.bill.controller.admin;

import com.wing.bill.service.GetNewReportService;
import com.wing.common.utils.JsonResult;
import com.wing.common.utils.PageResult;
import com.wing.web.utils.JwtUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Validated
@Api(value = "Admin-刀具柜领新库存报表", tags = "#/bill/getNewInventoryReport")
@RestController("getNewInventoryReportController")
@RequestMapping("bill/admin/getNewInventoryReport")
@RequiredArgsConstructor
public class GetNewInventoryReportController {

    private final GetNewReportService getNewReportService;

    @ApiOperation(value = "顶部折线图物料领新统计按天", notes = "搜索")
    @GetMapping("/list")
    public JsonResult list(
            @RequestParam("param")String param  //qua 数量 money金额
    ){
        return getNewReportService.list(param,JwtUtils.getEnterpriseCode());
    }

    @ApiOperation(value = "新报表-顶部格子数据物料数据统计", notes = "搜索")
    @GetMapping("/topCellNew")
    public JsonResult topCellNew(
            @RequestParam("startTime")String startTime//时间搜索 开始时间
            ,@RequestParam("endTime")String endTime//时间搜索 结束时间
            ,@RequestParam("click")String click//顶部数据点击
            ,@RequestParam("mainCabCode") String mainCabCode //主柜选择
    ){
        return getNewReportService.topCellNew(startTime,endTime,Integer.valueOf(click),mainCabCode,JwtUtils.getEnterpriseCode());
    }

    @ApiOperation(value = "新报表-物料领新记录按物料", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "selectParam", value="下拉选项参数(系列-spu 编号-sku 品牌-brand 类型-type 分类-category)", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "param", value = "开关参数(数量-qua 金额-money)",  dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "tab", value = "tab参数(总览tab-tab0 物料tab-tab1)",  dataType = "String", paramType = "query")
    })
    @GetMapping("/midFirstChartNew")
    public JsonResult midFirstChartNew(
            @RequestParam("startTime")String startTime//时间搜索 开始时间
            ,@RequestParam("endTime")String endTime//时间搜索 结束时间
            ,@RequestParam("selectParam")String selectParam//下拉选项参数 系列-spu 编号-sku 品牌-brand 类型-type 分类-category
            ,@RequestParam("param")String param //开关参数 qua 数量 money 金额
            ,@RequestParam("mainCabCode") String mainCabCode //主柜选择
            ,String tab
    ){
        return getNewReportService.midFirstChartNew(startTime,endTime,selectParam,param,JwtUtils.getEnterpriseCode(),mainCabCode,tab);
    }

    @ApiOperation(value = "新报表-物料领新情况按柜子，条件主柜、副柜", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "selectParam", value="下拉选项参数(主柜-main 副柜-desk)", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "param", value = "开关参数(数量-qua 金额-money)",  dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "tab", value = "tab参数(总览tab-tab0 柜子tab-tab1)",  dataType = "String", paramType = "query")
    })
    @GetMapping("/midSecondChartNew")
    public JsonResult midSecondChartNew(
            @RequestParam("startTime")String startTime//时间搜索 开始时间
            ,@RequestParam("endTime")String endTime//时间搜索 结束时间
            ,@RequestParam("selectParam")String selectParam//下拉选项参数 主柜-main 副柜-desk
            ,@RequestParam("param")String param //开关参数 qua 数量 money 金额
            ,@RequestParam("mainCabCode") String mainCabCode //主柜选择
            ,String tab
    ){
        return getNewReportService.midSecondChartNew(startTime,endTime,selectParam,param,JwtUtils.getEnterpriseCode(),mainCabCode,tab);
    }

    @ApiOperation(value = "新报表-物料领新情况按组织，条件领用人、部门、成本中心", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "selectParam", value="下拉选项参数(责任人-person 部门-department 成本中心-costCenter)", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "param", value = "开关参数(数量-qua 金额-money)",  dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "tab", value = "tab参数(总览tab-tab0 组织tab-tab1)",  dataType = "String", paramType = "query")
    })
    @GetMapping("/midThirdChartNew")
    public JsonResult midThirdChartNew(
            @RequestParam("startTime")String startTime//时间搜索 开始时间
            ,@RequestParam("endTime")String endTime//时间搜索 结束时间
            ,@RequestParam("selectParam")String selectParam//下拉选项参数 责任人-person 部门-department 成本中心-costCenter
            ,@RequestParam("param")String param //开关参数 不同的选项 qua 数量 money 金额
            ,@RequestParam("mainCabCode") String mainCabCode //主柜选择
            ,String tab
    ){
        return getNewReportService.midThirdChartNew(startTime,endTime,selectParam,param,JwtUtils.getEnterpriseCode(),mainCabCode,tab);
    }

    @ApiOperation(value = "新报表-物料领新情况按使用情况，条件工单、设备、车间", notes = "搜索")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "selectParam", value="下拉选项参数(工单-workOrder 车间-workShop 设备-device)", dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "param", value = "开关参数(数量-qua 金额-money)",  dataType = "String", paramType = "query")
            ,@ApiImplicitParam(name = "tab", value = "tab参数(总览tab-tab0 使用情况tab-tab1)",  dataType = "String", paramType = "query")
    })
    @GetMapping("/midFourChartNew")
    public JsonResult midFourChartNew(
            @RequestParam("startTime")String startTime//时间搜索 开始时间
            ,@RequestParam("endTime")String endTime//时间搜索 结束时间
            ,@RequestParam("selectParam")String selectParam//下拉选项参数  工单-workOrder 车间-workShop 设备-device
            ,@RequestParam("param")String param //开关参数  qua 数量 money 金额
            ,@RequestParam("mainCabCode") String mainCabCode //主柜选择
            ,String tab
    ){
        return getNewReportService.midFourChartNew(startTime,endTime,selectParam,param,JwtUtils.getEnterpriseCode(),mainCabCode,tab);
    }



    @ApiOperation(value = "物料领新列表", notes = "搜索")
    @GetMapping("/data")
    public PageResult data(
            @RequestParam(defaultValue = "1") Integer page
            ,@RequestParam(defaultValue = "10") Integer limit
            ,@RequestParam(defaultValue = "create_time") String sort
            ,@RequestParam(defaultValue = "desc") String order
            ,@RequestParam("type")String type//012 当日往前一周往前一月
            ,@RequestParam("startTime")String startTime//时间搜索 开始时间
            ,@RequestParam("endTime")String endTime//时间搜索 结束时间
            ,String mainCabCode
    ){
        return getNewReportService.data(type,startTime,endTime,page,limit,sort,order,mainCabCode);
    }




}
